using System;

namespace KodeIT.Web
{
    /// <summary>
    /// Contains the IIS raised events to which an <see cref="IHttpFilter"/> can subscribe
    /// during its lifetime.
    /// </summary>
    public interface IFilterEvents
    {
        /// <summary>
        /// This event is raised by IIS when it is reading raw data. 
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.ReadRawData"/> event.
        /// </summary>
        event EventHandler<RawDataEventArgs> ReadRawData;
        
        /// <summary>
        /// This event is raised by IIS when it is preprocessing a request's
        /// headers. If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.PreProcHeaders"/> event.
        /// </summary>
        event EventHandler<PreProcHeadersEventArgs> PreProcHeaders;

        /// <summary>
        /// This event is raised by IIS when it maps a URL to a physical directory. 
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.UrlMap"/> event.
        /// </summary>
        event EventHandler<UrlMapEventArgs> UrlMap;

        /// <summary>
        /// This event is raised by IIS just before IIS authenticates the client.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.Authentication"/> event.
        /// </summary>
        event EventHandler<AuthenticationEventArgs> Authentication;

        /// <summary>
        /// This event is raised by IIS when access is denied. If your HttpFilter should 
        /// be notified for this event, it should subscribe for the 
        /// <see cref="IFilterEvents.AccessDenied"/> event.
        /// </summary>
        event EventHandler<AccessDeniedEventArgs> AccessDenied;

        /// <summary>
        /// This event is raised by IIS after IIS has successfully completed authentication.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.AuthComplete"/> event.
        /// </summary>
        event EventHandler<AuthCompleteEventArgs> AuthComplete;

        /// <summary>
        /// This event is raised by IIS after the request has been processed by IIS, but before any headers are sent 
        /// back to the client.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.SendResponse"/> event.
        /// </summary>
        event EventHandler<SendResponseEventArgs> SendResponse;

        /// <summary>
        /// This event is raised by IIS as IIS sends raw data back to the client. May occur more than once per request.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.SendRawData"/> event.
        /// </summary>
        event EventHandler<RawDataEventArgs> SendRawData;

        /// <summary>
        /// This event is raised by IIS at the end of the request.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.EndOfRequest"/> event.
        /// </summary>
        event EventHandler<ContextEventArgs> EndOfRequest;

        /// <summary>
        /// This event is raised by IIS when it is writing information
        /// to a log file. 
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.Log"/> event.
        /// </summary>
        event EventHandler<LogEventArgs> Log;

        /// <summary>
        /// This event is raised by IIS when the network session with the client is ending.
        /// If your HttpFilter should be notified for this event, 
        /// it should subscribe for the <see cref="IFilterEvents.EndOfNetSession"/> event.
        /// </summary>
        event EventHandler<ContextEventArgs> EndOfNetSession;
    }
}
